#ifndef BE_COMMAND_SYSTEM_H_INCLUDED
#define BE_COMMAND_SYSTEM_H_INCLUDED

#include <map>
#include <string>
#include "src/utils/execcmd.h"
#include "src/utils/settings.h"

class BeCommandSystem
{
	public:
		struct cmd
		{
			cmdtype commandtype;
			cmdargtype argtype;

			void (*member)(int);
			void (BeCommandSystem::*commandsMember)();
			void (BeCommandSystem::*commandsMember_int)(int);
			void (Settings::*settingsMember)();
			void (Settings::*settingsMember_string)(const std::string&);
		};

		static BeCommandSystem* Instance();
		~BeCommandSystem();
		
		std::map<std::string, cmd*> cmdlist;

		void execCmd(const cmdsettings& cmds);
		void execCmd(const cmdsettings& cmds, int value);

		void quit();

		virtual void registerCmd(const std::string& name, void (BeCommandSystem::*pt2Func)());
		virtual void registerCmd(const std::string& name, void (BeCommandSystem::*pt2Func)(int));
		virtual void registerCmd(const std::string& name, void (Settings::*pt2Func)());
		virtual void registerCmd(const std::string& name, void (Settings::*pt2Func)(const std::string&));

		virtual void execCmd(const std::string& name);
		virtual void execCmd(const std::string& name, const std::string& str);
		virtual void execCmd(const std::string& name, int number);
		virtual void execCmd(const std::string& name, float floatingpoint) {};

		virtual void generalExecCmd(const std::string& name);
		virtual void generalExecCmd(const std::string& name, const std::string& str);
		virtual void generalExecCmd(const std::string& name, int number);

	protected:
		BeCommandSystem();
	private:
		static BeCommandSystem*	_instance;
		Settings*		settings;

		typedef std::map <std::string, cmd*>::const_iterator cmdlist_iterator;
		cmdlist_iterator cmdit;
};

#endif
